<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Laravel</title>

        <!-- Fonts -->
        <link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
        <script src="https://www.jq22.com/jquery/jquery-3.3.1.js"></script>
        <!-- Styles -->
        <style>
            html, body {
                background-color: #fff;
                color: #636b6f;
                font-family: 'Nunito', sans-serif;
                font-weight: 200;
                height: 100vh;
                margin: 0;
            }

            .full-height {
                height: 100vh;
            }

            .flex-center {
                align-items: center;
                display: flex;
                justify-content: center;
            }

            .position-ref {
                position: relative;
            }

            .top-right {
                position: absolute;
                right: 10px;
                top: 18px;
            }

            .content {
                text-align: center;
            }

            .title {
                font-size: 20px;
            }

            .links > a {
                color: #636b6f;
                padding: 0 25px;
                font-size: 13px;
                font-weight: 600;
                letter-spacing: .1rem;
                text-decoration: none;
                text-transform: uppercase;
            }

            .m-b-md {
                margin-bottom: 30px;
            }
        </style>
    </head>
    <body>
        <div class="flex-center position-ref full-height">
            <div class="gong">
                <input type="radio" id="type" name="type" value="1" />自动
                <input type="radio" id="type1" name="type" value="2" />手动
                <div class="title">工况：</div>
                <div class="shuru">
                    <!--粉尘堆积密度:(手输)<input type="text" name="bu_fen" value=""/><br>-->
                    烟气量:(假设通过采集)<input type="text" name="in_yan" id="in_yan" value="870000" style="color:red"/>m3/h<br>
                    入口粉尘浓度:(假设通过采集)<input type="text" name="in_fen" id="in_fen" value="3" style="color:red"/>g/m3<br>
                    室数:(假设提资表已有数据)<input type="text" name="shi" id="shi" value="2"/><br>
                    电场数:(假设提资表已有数据):4<!--<input type="text" name="N" id="N" value="4"/>--><br>
                    电场高度:(假设提资表已有数据)<input type="text" name="high" id="high" value="14.3"/>m<br>
                    单电场长度:(假设提资表已有数据)<input type="text" name="length" id="length" value="4"/>m<br>
                    单电场通道数:(假设提资表已有数据)<input type="text" name="tong" id="tong" value="20"/><br>
                    允许积尘厚度:(假设参数)<input type="text" name="jichen" id="jichen" value="2.5"/>mm<br>
                    各电场除尘效率:(假设参数)<input type="text" name="xiao" id="xiao" value="87"/>%
                </div><br>
                <div class="title">目前固定振打间隔时间：</div>
                <div class="shuru">
                    1电场阳极振打间隔时间：<input type="text" name="" value="120" style="color:green"/>s</br>
                    2电场阳极振打间隔时间：<input type="text" name="" value="300" style="color:green"/>s</br>
                    3电场阳极振打间隔时间：<input type="text" name="" value="480" style="color:green"/>s</br>
                    4电场阳极振打间隔时间：<input type="text" name="" value="1800" style="color:green"/>s</br>
                </div><br>
                <div class="title">计算之后的振打间隔时间：</div>
                <div class="shuru">
                    1电场阳极振打间隔时间：<input type="text" name="t1" id="t1" value="120" style="color:red"/>s</br>
                    2电场阳极振打间隔时间：<input type="text" name="t2" id="t2" value="300" style="color:red"/>s</br>
                    3电场阳极振打间隔时间：<input type="text" name="t3" id="t3" value="480" style="color:red"/>s</br>
                    4电场阳极振打间隔时间：<input type="text" name="t4" id="t4" value="1800" style="color:red"/>s</br>
                </div><br>
                <div class="title">出口粉尘浓度:(假设参数,通过采集)<label id="chukou" style="color:red">80</label>g/m3</div>
                <div id="jia"></div>
            </div>
        </div>
        <script>

            $(function(){
                var aa;
                $("#type").click(function(){
                    if(document.getElementById('tijiao')){
                        document.getElementById('tijiao').remove();
                    }
                    aa = setInterval("zidong()",5000);
                });
                $("#type1").click(function(){
                    clearInterval(aa);
                    document.getElementById('jia').innerHTML="<input id='tijiao' name='tijiao' type='button' value='提交' />";
                });
                $("#jia").click(function(){
                    zidong();
                });
            })

            function zidong(){
                var in_yan = parseInt(Math.random()*(1600000-600000+1)+600000);
                $("#in_yan").val(in_yan);
                var in_fen = Math.random()*(4-2+1)+2;
                $("#in_fen").val(in_fen.toFixed(2));
                shi = $("#shi").val();
                high = $("#high").val();
                length = $("#length").val();
                tong = $("#tong").val();
                jichen = $("#jichen").val();
                xiao = $("#xiao").val();
                var data1 = {
                    in_yan:in_yan,
                    in_fen:in_fen,
                    shi:shi,
                    high:high,
                    length:length,
                    tong:tong,
                    jichen:jichen,
                    xiao:xiao
                }
                url = "{{ URL::asset('jisuan') }}";
                $.ajax({
                    type : "POST",
                    url : url,
                    data : data1,
                    success : function(result) {
                        if(result.code){
                            $("#t1").val(result.data.t1);
                            $("#t2").val(result.data.t2);
                            $("#t3").val(result.data.t3);
                            $("#t4").val(result.data.t4);
                        }
                        var chukou = parseInt(Math.random()*(60-50+1)+50);
                        $("#chukou").html(chukou);
                    },
                    error : function(e){
                       // console.log(2)
                    }
                });
            }
        </script>
    </body>
</html>